/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui.renderer;

import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;

/**
 *
 * @author Joris
 */
public class CustomIconRenderer extends DefaultTreeCellRenderer {
    
    ImageIcon nodeIcon;
    ImageIcon leafIcon;

    public CustomIconRenderer() {
        nodeIcon = new ImageIcon(CustomIconRenderer.class.getResource("/images/plus.png"));
        leafIcon = new ImageIcon(CustomIconRenderer.class.getResource("/images/min.png"));
    }

    @Override
    public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {
        super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
        if (leaf) {
            setIcon(leafIcon);
        } else {
            setIcon(nodeIcon);
        } 
        return this;
    }
    
    
    
    
    
}
